package com.gupao.gupaoeduvippattern.pattern.observer.guava;

import com.google.common.eventbus.EventBus;
import org.junit.jupiter.api.Test;

/**
 * @author 大帅
 * @description
 * @date 2020-12-02
 */
public class TestDemo {

    @Test
    public void test1(){
        //消息总线
        EventBus eventBus = new EventBus();
        GuavaEvent ge = new GuavaEvent();
        GuavaEvent ge2 = new GuavaEvent();
        POJOEvent pe = new POJOEvent();

        //注册到消息总线中
        eventBus.register(ge);
        eventBus.register(ge2);
        eventBus.register(pe);

        //通知所有的观察者，只要方法上加了注解@Subscribe
        eventBus.post("开始学习吧！");


    }

}
